//
//  HDCFMangerPwVc.m
//  HaoDeCaiFu
//
//  Created by 郑开宏 on 2017/11/4.
//  Copyright © 2017年 郑开宏. All rights reserved.
//

#import "HDCFMangerPwVc.h"
#import "HDCFSettingCell.h"
#import "HDCFModifyPasswordVc.h"
#import "HDCFForgetPwVc.h"
#import "SVProgressHUD.h"

@interface HDCFMangerPwVc ()

@property (nonatomic, strong) NSArray *imageAry;
@property (nonatomic, strong) NSArray *titleArray;
@property (nonatomic, strong) NSArray *detailArray;
@end

@implementation HDCFMangerPwVc

- (NSArray *)imageAry{
    if (!_imageAry) {
        self.imageAry = [NSArray arrayWithObjects:@"icon_mima", @"icon_mima", @"icon_mima",nil];
    }
    return _imageAry;
}

- (NSArray *)titleArray{
    if (!_titleArray) {
        self.titleArray = [NSArray arrayWithObjects:@"修改登录密码", @"修改交易密码", @"忘记交易密码", nil];
    }
    return _titleArray;
}

- (NSArray *)detailArray{
    if (!_detailArray) {
        self.detailArray = [NSArray arrayWithObjects:@"修改登录密码", @"修改交易密码", @"忘记交易密码", nil];
    }
    return _detailArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.navigationItem setTitle:@"密码管理"];
    
    self.view.backgroundColor = ZKcolor(245, 245, 245);
    self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    self.tableView.separatorColor = ZKcolor(245, 245, 245);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.imageAry.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellID = @"cellid";
    HDCFSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (!cell) {
        cell = [HDCFSettingCell HDCFSettingCell];
    }
    
    NSString *title = self.titleArray[indexPath.row];
    cell.titleLable.text = title;
    
    if (indexPath.row == 1 || indexPath.row == 0){
        cell.detailLabel.text = @"使用当前密码重置";
    }else{
        cell.detailLabel.text = @"使用证件号和手机号重置";
    }
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        
        HDCFModifyPasswordVc *vc = [[HDCFModifyPasswordVc alloc] init];
        vc.title = @"修改登录密码";
        vc.isTradePassword = NO;
        [self.navigationController pushViewController:vc animated:YES];
    }else if (indexPath.row == 1) {
        NSString *openStatus = kOpenStatus;
        if (!(openStatus.integerValue > 0)){
            [SVProgressHUD showInfoWithStatus:@"请先开户"];
            [SVProgressHUD dismissWithDelay:1.0];
            return;
        }
        HDCFModifyPasswordVc *vc = [[HDCFModifyPasswordVc alloc] init];
        vc.title = @"修改交易密码";
        vc.isTradePassword = YES;
        [self.navigationController pushViewController:vc animated:YES];
    }else{
        NSString *openStatus = kOpenStatus;
        if (!(openStatus.integerValue > 0)){
            [SVProgressHUD showInfoWithStatus:@"请先开户"];
            [SVProgressHUD dismissWithDelay:1.0];
            return;
        }
        HDCFForgetPwVc *vc = [[HDCFForgetPwVc alloc] init];
        vc.isTradeForget = YES;
        [self.navigationController pushViewController:vc animated:YES];
    }
}

@end
